package com.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.demo.dao.UserDAO;
import com.demo.model.User;
import com.demo.service.UserService;
 
 
 
@Service
public class UserServiceImpl implements UserService{
 
    @Autowired
    @Qualifier("userDAO")
    private UserDAO userDAO;

	public int deleteByPrimaryKey(Integer id) {
		int n = userDAO.deleteByPrimaryKey(id);
		return 0;
	}

	public int insert(User user) {
		int n = userDAO.insert(user);
		return 0;
	}

	public int insertSelective(User record) {
		// TODO Auto-generated method stub
		return 0;
	}

	public User selectByPrimaryKey(String useraccount, String userpassword) {
		User user = userDAO.selectByPrimaryKey(useraccount, userpassword);
		if(user != null){
			return user;
		}
		return null;
	}

	public int updateByPrimaryKeySelective(User record) {
		// TODO Auto-generated method stub
		return 0;
	}

	public int updateByPrimaryKey(User record) {
		int n = userDAO.updateByPrimaryKey(record);
		return 0;
	}

	public List<User> selectAll() {
		List<User> userList = userDAO.selectAll();
		return userList;
	}

	public List<User> selectLike(String useraccount, String username,String usermobile) {
		List<User> userList = userDAO.selectLike(useraccount,username,usermobile);
		return userList;
	}

	public User selectById(Integer id) {
		User user = userDAO.selectById(id);
		return user;
	}
  
 
}